<?php

use yii\helpers\Html;
use yii\widgets\DetailView;

/* @var $this yii\web\View */
/* @var $model app\models\GkyQyhDepartment */

$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => 'Gky Qyh Departments', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="gky-qyh-department-view">

    <div class="bg-info" style="width: 100%;height: 80px;border:1px solid #ddd;border-radius: 3px;">
        <p class="text-primary"style=" color: #0066cc;font-size: 20px;margin-left: 10px;">信息一览</p>
        <div style="float: right;">
            <?= Html::a('更新', ['update', 'id' => $model->id], ['class' => 'btn btn-info', 'style' => 'margin-right:5px']) ?>
            <?= Html::a('新建', ['create'], ['class' => 'btn btn-info', 'style' => 'margin-right:5px']) ?>
            <?= Html::a('返回', ['index'], ['class' => 'btn btn-info', 'style' => 'margin-right:10px']) ?>
        </div>
    </div>

    <?=
    DetailView::widget([
        'model' => $model,
        'attributes' => [
//            'id',
//            'dno',
            'name',
//            'parentid',
            [
                'attribute' => 'parentid',
                'label' => '父级名称',
                'value' => $model->parent ? $model->parent->name : "",
            ],
//            'order',
//            'qyh_id',
        ],
    ])
    ?>
    
    <?php 
        if($model->parent){
            echo '<h4>成员</h4>';
        }
    ?>
    <?php
    $users = $model->deptUsers;
    if ($users != null) {
        foreach ($users as $user) {
            echo '<span style="margin-left:5px">' . $user->user->name . '</span>';
        }
    }
    ?>

</div>
